 

package com.zdkj.subway.rca.controller;


import com.zdkj.common.core.util.R;


import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.rca.service.SwCkClearRulesService;
import com.zdkj.subway.rca.service.SwCkDiffAfterClearReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;


/**
 * 清分及划账-清分后数据差异报表管理
 *
 * @author stw
 * @date 2021-01-03 21:58:58
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swckdiffafterclearreport" )
@Api(value = "swckdiffafterclearreport", tags = "清分及划账-清分后数据差异报表管理")
public class SwCkDiffAfterClearReportController {
    @Autowired
    private SwCkDiffAfterClearReportService swCkDiffAfterClearReportService;

    @Autowired
    private SwCkClearRulesService swCkClearRulesService;

    /**
     * 运营商下拉列表
     * @return
     */
    @ApiOperation(value = "运营商下拉列表", notes = "运营商下拉列表")
    @GetMapping("/listoperators" )
    public R listoperators() {
        return R.ok(swCkClearRulesService.getServiceMap());
    }

    /**
     * 查询
     * @return
     */
    @ApiOperation(value = "查询", notes = "查询")
    @GetMapping("/list" )
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "statisticsMonth", value = "统计月份：yyyy-MM", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "operators", value = "运营商编码", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "lineCode", value = "线路编码", dataTypeClass = String.class)
            }
    )
    public R getSwCkDiffAfterClearReportlistDTO(String statisticsMonth,String operators,String lineCode) {

        return R.ok(swCkDiffAfterClearReportService.listSwCkDiffAfterClearReportDTO(statisticsMonth,operators,lineCode));
    }


    /**
     * 导出
     * @param
     * @return
     */
    @ApiOperation(value = "导出", notes = "导出")
    @GetMapping({"/export"})
    @SysLog("清分及划账-清分后数据差异报表管理-导出")
    @PreAuthorize("@pms.hasPermission('sw_ck_diff_after_clear_report_export')")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "statisticsMonth", value = "统计月份：yyyy-MM", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "operators", value = "运营商编码", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "lineCode", value = "线路编码", dataTypeClass = String.class)
            }
    )
    public void export(String statisticsMonth,String operators,String lineCode, HttpServletResponse response) {

        swCkDiffAfterClearReportService.export(statisticsMonth,operators,lineCode,response);

    }


}
